package org.appfuse.webapp.listener;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import org.acegisecurity.providers.AuthenticationProvider;
import org.acegisecurity.providers.ProviderManager;
import org.acegisecurity.providers.encoding.Md5PasswordEncoder;
import org.acegisecurity.providers.rememberme.RememberMeAuthenticationProvider;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.appfuse.Constants;
import org.appfuse.model.Bj001;
import org.appfuse.model.Bj008;
import org.appfuse.model.Bj011;
import org.appfuse.model.Bj012;
import org.appfuse.model.Bj77;
import org.appfuse.model.Bj90;
import org.appfuse.model.G099;
import org.appfuse.model.Gb;
import org.appfuse.model.Gb10301;
import org.appfuse.model.Gb12403;
import org.appfuse.model.Gb2260;
import org.appfuse.model.Gb2261;
import org.appfuse.model.Gb3304;
import org.appfuse.model.Gb4658;
import org.appfuse.model.Gb4761;
import org.appfuse.model.Gb4762;
import org.appfuse.model.Gb4766;
import org.appfuse.model.Gb4767;
import org.appfuse.model.Gb6864;
import org.appfuse.model.Gb8561;
import org.appfuse.model.Gbt4754;
import org.appfuse.model.LabelValue;
import org.appfuse.model.Zb03;
import org.appfuse.model.Zb04;
import org.appfuse.model.Zb06;
import org.appfuse.model.Zb10;
import org.appfuse.model.Zb11;
import org.appfuse.model.Zb12;
import org.appfuse.model.Zb13;
import org.appfuse.model.Zb14;
import org.appfuse.model.Zb15;
import org.appfuse.model.Zb16;
import org.appfuse.model.Zb24;
import org.appfuse.model.Zb26;
import org.appfuse.model.Zb32;
import org.appfuse.model.Zb41;
import org.appfuse.model.Zb47;
import org.appfuse.model.Zb49;
import org.appfuse.model.Zb52;
import org.appfuse.model.Zb53;
import org.appfuse.model.Zb56;
import org.appfuse.model.Zb904;
import org.appfuse.model.ZnodeTree;
import org.appfuse.model.Zb09;
import org.appfuse.model.Zb17;
import org.appfuse.model.Zb18;
import org.appfuse.model.Zb19;
import org.appfuse.model.Zb27;
import org.appfuse.model.Zb28;
import org.appfuse.model.Zb29;
import org.appfuse.model.Zb30;
import org.appfuse.model.Zb31;
import org.appfuse.model.Zb33;
import org.appfuse.model.Zb42;
import org.appfuse.model.Zb910;
import org.appfuse.service.GbManager;
import org.appfuse.service.LookupManager;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.support.WebApplicationContextUtils;

/**
 * <p>
 * StartupListener class used to initialize and database settings and populate
 * any application-wide drop-downs.
 * 
 * <p>
 * Keep in mind that this listener is executed outside of
 * OpenSessionInViewFilter, so if you're using Hibernate you'll have to
 * explicitly initialize all loaded data at the Dao or service level to avoid
 * LazyInitializationException. Hibernate.initialize() works well for doing
 * this.
 * 
 * @author <a href="mailto:matt@raibledesigns.com">Matt Raible</a>
 * 
 * @web.listener
 */
public class StartupListener extends ContextLoaderListener implements
		ServletContextListener {

	private static final Log log = LogFactory.getLog(StartupListener.class);

	public void contextInitialized(ServletContextEvent event) {
		if (log.isDebugEnabled()) {
			log.debug("initializing context...");
		}

		// call Spring's context ContextLoaderListener to initialize
		// all the context files specified in web.xml
		super.contextInitialized(event);

		ServletContext context = event.getServletContext();

		// Orion starts Servlets before Listeners, so check if the config
		// object already exists
		Map config = (HashMap) context.getAttribute(Constants.CONFIG);

		if (config == null) {
			config = new HashMap();
		}

		if (context.getInitParameter("theme") != null) {
			config.put("theme", context.getInitParameter("theme"));
		}

		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);

		boolean encryptPassword = false;
		try {
			ProviderManager provider = (ProviderManager) ctx
					.getBean("authenticationManager");
			for (Iterator it = provider.getProviders().iterator(); it.hasNext();) {
				AuthenticationProvider p = (AuthenticationProvider) it.next();
				if (p instanceof RememberMeAuthenticationProvider) {
					// config.put("rememberMeEnabled", Boolean.TRUE);
					config.put("rememberMeEnabled", Boolean.FALSE);
				}
			}

			if (ctx.containsBean("passwordEncoder")) {
				encryptPassword = true;
				config.put(Constants.ENCRYPT_PASSWORD, Boolean.TRUE);
				String algorithm = "SHA";
				if (ctx.getBean("passwordEncoder") instanceof Md5PasswordEncoder) {
					algorithm = "MD5";
				}
				config.put(Constants.ENC_ALGORITHM, algorithm);
			}
		} catch (NoSuchBeanDefinitionException n) {
			// ignore, should only happen when testing
		}

		context.setAttribute(Constants.CONFIG, config);

		// output the retrieved values for the Init and Context Parameters
		if (log.isDebugEnabled()) {
			log
					.debug("Remember Me Enabled? "
							+ config.get("rememberMeEnabled"));
			log.debug("Encrypt Passwords? " + encryptPassword);
			if (encryptPassword) {
				log.debug("Encryption Algorithm: "
						+ config.get(Constants.ENC_ALGORITHM));
			}
			log.debug("Populating drop-downs...");
		}

		setupContext(context);
	}

	public static void setupContext(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);

		LookupManager mgr = (LookupManager) ctx.getBean("lookupManager");

		// get list of possible roles
		context.setAttribute(Constants.AVAILABLE_ROLES, mgr.getAllRoles());

		initialGb2261(context);
		initialGb2260(context);
		initialGb3304(context);
		initialG099(context);

		initialZB18(context);
		initialZB19(context);
		initialZB28(context);
		initialZB30(context);
		initialZB31(context);
		initialZB27(context);
		initialZB29(context);
		initialGB10301(context);
		initialGB4658(context);
		initialGB8561(context);
		initialZB42(context);
		initialGB12403(context);
		initialZB09(context);
		initialZB17(context);
		initialGB6864(context);
		initialZB33(context);
		initialZB910(context);
		initialGB(context);
		initialBJ77(context);
		initialZNodeTree(context);
		initialGB4766(context);
		initialGB4767(context);
		initialGB4762(context);
		initialZB06(context);
		initialBJ011(context);
		initialZB24(context);
		initialZB10(context);
		initialBJ012(context);
		initialZB03(context);
		initialZB32(context);
		initialBJ008(context);
		initialZB41(context);
		initialGBT4754(context);
		initialBJ90(context);
		initialBJ001(context);
		initialZB11(context);
		initialZB12(context);
		initialZB13(context);
		initialZB14(context);
		initialZB15(context);
		initialZB16(context);
		initialZB04(context);
		initialZB26(context);
		initialZB56(context);
		initialGB4761(context);
		initialZB52(context);
		initialZB53(context);
		initialZB49(context);
		initialZB904(context);
		initialZB47(context);
		

		if (log.isDebugEnabled()) {
			log.debug("Drop-down initialization complete [OK]");
		}
	}

	public static void initialGb2261(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findGb2261();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Gb2261 gb = (Gb2261) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmLevCod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.GB2261, lvs);
		Constants.GB2261_MAP = map;
	}

	public static void initialGb2260(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findGb2260();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Gb2260 gb = (Gb2260) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.GB2260, lvs);
		Constants.GB2260_MAP = map;
	}

	public static void initialGb3304(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findGb3304();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Gb3304 gb = (Gb3304) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.GB3304, lvs);
		Constants.GB3304_MAP = map;
	}

	public static void initialG099(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findG099();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			G099 gb = (G099) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.G099, lvs);
		Constants.G099_MAP = map;
	}

	public static void initialZB09(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findZb09();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Zb09 gb = (Zb09) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.ZB09, lvs);
		Constants.ZB09_MAP = map;
	}

	public static void initialGB12403(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findGb12403();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Gb12403 gb = (Gb12403) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.GB12403, lvs);
		Constants.GB12403_MAP = map;
	}

	public static void initialZB42(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findZb42();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Zb42 gb = (Zb42) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.ZB42, lvs);
		Constants.ZB42_MAP = map;
	}

	public static void initialGB8561(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findGb8561();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Gb8561 gb = (Gb8561) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.GB8561, lvs);
		Constants.GB8561_MAP = map;
	}

	public static void initialGB4658(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findGb4658();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Gb4658 gb = (Gb4658) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.GB4658, lvs);
		Constants.GB4658_MAP = map;
	}

	public static void initialGB10301(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findGb10301();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Gb10301 gb = (Gb10301) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.GB10301, lvs);
		Constants.GB10301_MAP = map;
	}

	public static void initialZB29(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findZb29();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Zb29 gb = (Zb29) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.ZB29, lvs);
		Constants.ZB29_MAP = map;
	}

	public static void initialZB27(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findZb27();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Zb27 gb = (Zb27) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.ZB27, lvs);
		Constants.ZB27_MAP = map;
	}

	// todo

	public static void initialZB31(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findZb31();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Zb31 gb = (Zb31) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.ZB31, lvs);
		Constants.ZB31_MAP = map;
	}

	public static void initialZB30(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findZb30();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Zb30 gb = (Zb30) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.ZB30, lvs);
		Constants.ZB30_MAP = map;
	}

	public static void initialZB28(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findZb28();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Zb28 gb = (Zb28) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.ZB28, lvs);
		Constants.ZB28_MAP = map;
	}

	public static void initialZB17(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findZb17();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Zb17 gb = (Zb17) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.ZB17, lvs);
		Constants.ZB17_MAP = map;
	}

	public static void initialGB6864(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findGb6864();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Gb6864 gb = (Gb6864) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.GB6864, lvs);
		Constants.GB6864_MAP = map;
	}

	public static void initialZB19(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findZb19();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Zb19 gb = (Zb19) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.ZB19, lvs);
		Constants.ZB19_MAP = map;
	}

	public static void initialZB18(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findZb18();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Zb18 gb = (Zb18) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.ZB18, lvs);
		Constants.ZB18_MAP = map;
	}

	public static void initialZB33(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findZb33();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Zb33 gb = (Zb33) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.ZB33, lvs);
		Constants.ZB33_MAP = map;
	}

	public static void initialGB(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findGb();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Gb gb = (Gb) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.GB, lvs);
		Constants.GB_MAP = map;
	}

	public static void initialZB910(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findZb910();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Zb910 gb = (Zb910) it.next();
			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getId().getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getId().getDmcod(), gb);
			}

		}
		context.setAttribute(Constants.ZB910, lvs);
		Constants.ZB910_MAP = map;
	}

	public static void initialBJ77(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findBj77();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Bj77 gb = (Bj77) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getId().getDmcod());
			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getId().getDmcod(), gb);
			}

		}
		context.setAttribute(Constants.BJ77, lvs);
		Constants.BJ77_MAP = map;
	}

	public static void initialZNodeTree(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findZNodeTree();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			ZnodeTree gb = (ZnodeTree) it.next();

			LabelValue lv = new LabelValue(gb.getFullName(), gb.getNodeId());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getNodeId(), gb);
			}

		}
		context.setAttribute(Constants.ZNODETREE, lvs);
		Constants.ZNODETREE_MAP = map;
	}

	public static void initialZB06(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findZb06();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Zb06 gb = (Zb06) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.ZB06, lvs);
		Constants.ZB06_MAP = map;
	}

	public static void initialGB4766(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findGb4766();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Gb4766 gb = (Gb4766) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.GB4766, lvs);
		Constants.GB4766_MAP = map;
	}

	public static void initialGB4767(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findGb4767();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Gb4767 gb = (Gb4767) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.GB4767, lvs);
		Constants.GB4767_MAP = map;
	}

	public static void initialGB4762(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findGb4762();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Gb4762 gb = (Gb4762) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.GB4762, lvs);
		Constants.GB4762_MAP = map;
	}

	public static void initialBJ011(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findBj011();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Bj011 gb = (Bj011) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.BJ011, lvs);
		Constants.BJ011_MAP = map;
	}

	public static void initialZB24(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findZb24();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Zb24 gb = (Zb24) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.ZB24, lvs);
		Constants.ZB24_MAP = map;
	}

	public static void initialZB10(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findZb10();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Zb10 gb = (Zb10) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.ZB10, lvs);
		Constants.ZB10_MAP = map;
	}

	public static void initialBJ012(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findBj012();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Bj012 gb = (Bj012) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.BJ012, lvs);
		Constants.BJ012_MAP = map;
	}

	public static void initialZB03(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findZb03();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Zb03 gb = (Zb03) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.ZB03, lvs);
		Constants.ZB03_MAP = map;
	}

	public static void initialZB32(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findZb32();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Zb32 gb = (Zb32) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.ZB32, lvs);
		Constants.ZB32_MAP = map;
	}
	
	
	public static void initialBJ008(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findBj008();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Bj008 gb = (Bj008) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.BJ008, lvs);
		Constants.BJ008_MAP = map;
	}
	
	public static void initialBJ001(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findBj001();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Bj001 gb = (Bj001) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.BJ001, lvs);
		Constants.BJ001_MAP = map;
	}
	
	
	public static void initialBJ90(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findBj90();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Bj90 gb = (Bj90) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.BJ90, lvs);
		Constants.BJ90_MAP = map;
	}
	
	
	public static void initialZB41(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findZb41();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Zb41 gb = (Zb41) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.ZB41, lvs);
		Constants.ZB41_MAP = map;
	}
	
	
	public static void initialGBT4754(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findGbt4754();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Gbt4754 gb = (Gbt4754) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.GBT4754, lvs);
		Constants.GBT4754_MAP = map;
	}
	
	
	public static void initialZB11(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findZb11();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Zb11 gb = (Zb11) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.ZB11, lvs);
		Constants.ZB11_MAP = map;
	}
	
	
	public static void initialZB12(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findZb12();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Zb12 gb = (Zb12) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.ZB12, lvs);
		Constants.ZB12_MAP = map;
	}
	
	public static void initialZB13(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findZb13();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Zb13 gb = (Zb13) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.ZB13, lvs);
		Constants.ZB13_MAP = map;
	}	
	
	
	public static void initialZB14(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findZb14();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Zb14 gb = (Zb14) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.ZB14, lvs);
		Constants.ZB14_MAP = map;
	}
	
	
	public static void initialZB15(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findZb15();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Zb15 gb = (Zb15) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.ZB15, lvs);
		Constants.ZB15_MAP = map;
	}
	
	
	public static void initialZB16(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findZb16();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Zb16 gb = (Zb16) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.ZB16, lvs);
		Constants.ZB16_MAP = map;
	}
	
	public static void initialZB04(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findZb04();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Zb04 gb = (Zb04) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.ZB04, lvs);
		Constants.ZB04_MAP = map;
	}
	
	public static void initialZB26(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findZb26();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Zb26 gb = (Zb26) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.ZB26, lvs);
		Constants.ZB26_MAP = map;
	}
	
	
	public static void initialZB56(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findZb56();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Zb56 gb = (Zb56) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.ZB56, lvs);
		Constants.ZB56_MAP = map;
	}
	
	
	public static void initialGB4761(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findGb4761();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Gb4761 gb = (Gb4761) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.GB4761, lvs);
		Constants.GB4761_MAP = map;
	}
	
	public static void initialZB52(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findZb52();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Zb52 gb = (Zb52) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.ZB52, lvs);
		Constants.ZB52_MAP = map;
	}
	
	public static void initialZB53(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findZb53();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Zb53 gb = (Zb53) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.ZB53, lvs);
		Constants.ZB53_MAP = map;
	}
	
	public static void initialZB49(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findZb49();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Zb49 gb = (Zb49) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.ZB49, lvs);
		Constants.ZB49_MAP = map;
	}
	
	public static void initialZB904(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findZb904();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Zb904 gb = (Zb904) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.ZB904, lvs);
		Constants.ZB904_MAP = map;
	}
	
	public static void initialZB47(ServletContext context) {
		ApplicationContext ctx = WebApplicationContextUtils
				.getRequiredWebApplicationContext(context);
		GbManager mgr = (GbManager) ctx.getBean("gbManager");
		List gbs = mgr.findZb47();
		Iterator it = gbs.iterator();
		List lvs = new ArrayList();
		HashMap map = new HashMap(0);
		while (it.hasNext()) {
			Zb47 gb = (Zb47) it.next();

			LabelValue lv = new LabelValue(gb.getDmCpt(), gb.getDmcod());

			if (!gbs.contains(lv)) {
				// lvs.add(new LabelValue(gb.getDmCpt(), gb.getDmcod()));
				lvs.add(lv);
				map.put(gb.getDmcod(), gb.getDmCpt());
			}

		}
		context.setAttribute(Constants.ZB47, lvs);
		Constants.ZB47_MAP = map;
	}
}
